package com.smforj.ssm.modules.lib.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * 菜单事件处理key
 * 针对微信事件
 * 
 * @author Haijun Gao 
 * @date 2016-8-6 下午4:27:21
 * @desp http://www.cnblogs.com/saga5998/
 * @email 573107773@qq.com
 */
public enum EventKey { 
	/**
	 *  借
	 */
    CHECKOUT("checkout"),
    /**
	 *  续借
	 */
    REVEW("revew"),
    /**
  	 *  查询
  	 */
    QUERY("query"),
    
    Null("null");
    
    private String text;
    
    EventKey(String text) {
        this.text = text;
    }
    
    public String getText() {
        return this.text;
    }
    @Override
    public String toString() {
        return text;
    }
    
    // Implementing a fromString method on an enum type
    private static final Map<String, EventKey> stringToEnum = new HashMap<String, EventKey>();
    
    static {
        // Initialize map from constant name to enum constant
        for(EventKey key : values()) {
            stringToEnum.put(key.toString(), key);
        }
    }
    
    // Returns Blah for string, or null if string is invalid
    public static EventKey fromString(String symbol) {  
    	EventKey mk = stringToEnum.get(symbol);  
    	return mk == null ? EventKey.Null : mk; 
    }
}
